/**
 * 
 */
package com.subnext.service;

import java.util.List;

import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;

import com.subnext.dao.CategoryDao;
import com.subnext.model.CategoryEntity;
import com.subnext.model.Paging;
/**
 * @author amit
 *
 */
@RemotingDestination(channels={"my-amf","my-secure-amf"})
public class CategoryService{
	
	private CategoryDao dao;
	
	public CategoryService(CategoryDao dao) {
		this.dao = dao;
	}

	@RemotingInclude
	public CategoryEntity getById(Long id){
		CategoryEntity categoryEntity = new CategoryEntity();
		categoryEntity.setName("Test Category");
		categoryEntity.setId(1L);
		return categoryEntity;
	}
	
	@RemotingInclude
	public CategoryEntity save(CategoryEntity categoryEntity){
		
		return dao.save(categoryEntity);
	}
	
	@RemotingInclude
	public List<CategoryEntity> getAll(){
		return dao.get(new Paging());
	}
}
